/**
 * @AppTest4.java  COPYRIGHT xiaojian
 * 
 * Created on 2019年8月20日 下午3:01:46
 */
package xj.toolkit.bean.bytebean;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import xj.toolkit.bean.bytebean.core.BeanFieldCodec;
import xj.toolkit.util.ByteUtils;

/**
 * @author <a href="mailto:cxj2000@gmail.com">xiaojian.cao</a>
 *
 */
public class AppTest4 {
	
	public static void main(String[] args) {
		AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
				"codec.xml");

		BeanFieldCodec beanCodec = (BeanFieldCodec) ctx.getBean("byteBeanCodec");
		
		TM_JWST_10W1_sensory sensory = new TM_JWST_10W1_sensory();
		
		byte[] bytesBody = beanCodec.encode(beanCodec
				.getEncContextFactory().createEncContext(sensory, TM_JWST_10W1_sensory.class,
						null));
		
		System.out.println(ByteUtils.bytesAsHexString(bytesBody, 1024));

		System.out.println(beanCodec.decode(beanCodec
				.getDecContextFactory().createDecContext(bytesBody,
						TM_JWST_10W1_sensory.class, null, null)).getValue());
	
		ctx.close();
	}


}
